package com.example.rent.mapper.tly;

import com.example.rent.entity.Tenant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.rent.entity.Teninhouse;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wanted
 * @since 2021-12-02
 */
@Repository
public interface TenantMapper extends BaseMapper<Tenant> {
    @Update("update tenant set tphone=#{phone} where tphone=#{id}")
    int updatephone( String id,  String phone);

    @Update("update tenant set password=#{password} where tphone=#{id}")
    int updatepwd(String id, String password);

    @Select("select address from house")
    List<String> queryaddress();

    @Select("select houseid from house where address=#{roomname}")
    Long queryAddress(String roomname);

    @Insert("insert into repair(tphone,houseid,description) value(#{id},#{houseid},#{descript})")
    int insertrepaire(String id, Long houseid, String descript);

    @Select("select freetime from houseowner where hphone=#{phone}")
    String getFreetime(Long phone);

    @Select("select address from house where houseid=#{id}")
    String gethouseaddress(int id);

    @Select("select * from teninhouse where tphone=#{id}")
    List<Teninhouse> getlist(String id);
}
